
import lejos.nxt.Motor;
import lejos.nxt.Sound;


public class LejosMotorIO {

	/**
	 * MOTOR PART 
	 */
	
	
	 /**
	  * Variable Garantit un seul Check au plus par
	  * Tick
	  */
	 public static boolean KeyChecked = false;
	 public static boolean ENTER;
	 public static boolean LEFT;
	 public static boolean RIGHT;
	 public static boolean ESCAPE;
	 public static boolean Touch=true;
	 

    	 
	 public static void  ResetKeysForNextTick(){ 
		 KeyChecked = false;
		 LEFT=false;
		 RIGHT=false;
		 ENTER=false;
		 ESCAPE=false;
		 Touch = true;
		 
	}
	 
	
	/*Liste des signaux autorisés:
	 * NON valués
		A_GETSPEED, B_GETSPEED, C_GETSPEED	
	*	A_ISMOVING, B_ISMOVING, C_ISMOVING
	*
		A_Forward,  B_Forward,  C_Forward
	*	A_Backward, B_Backward, C_Backward
	*	A_STOP,  B_STOP,  C_STOP
	*	BEEP
	*
	*Valués:
	*	A_SETSPEED, B_SETSPEED, C_SETSPEED
	*/ 

	 public static boolean inputA_ISMOVING(){

			return Motor.A.isMoving();
		}

		public static boolean inputB_ISMOVING(){

			return Motor.B.isMoving();
		}

		public static boolean inputC_ISMOVING(){

			return Motor.C.isMoving();
		}
		
		public static int inputA_GETSPEED(){
			
			return Motor.A.getSpeed();
		}
		
		public static int inputB_GETSPEED(){
			
			return Motor.B.getSpeed();
		}
		
		public static int inputC_GETSPEED(){
		
			return Motor.C.getSpeed();
		}

	public static void outputA_FORWARD(){	 
		Motor.A.forward();
	}
	public static void outputB_FORWARD(){
		Motor.B.forward(); 
	}
	public static void outputC_FORWARD(){
		Motor.C.forward();
	}

	public static void outputA_BACKWARD(){	 
		Motor.A.backward();
	}
	public static void outputB_BACKWARD(){
		Motor.B.backward(); 
	}
	public static void outputC_BACKWARD(){
		Motor.C.backward();
	}

	public static void outputA_SETSPEED(int val){
		Motor.A.setSpeed(val);
	}
	public static void outputA_SETSSPEED(float val){
		Motor.A.setSpeed(val);
	}

	public static void outputB_SETSPEED(int val){
		Motor.B.setSpeed(val);
	}
	public static void outputB_SETSPEED(float val){
		Motor.B.setSpeed(val);
	}

	public static void outputC_SETSPEED(int val){
		Motor.C.setSpeed(val);
	}
	public static void outputC_SETSPEED(float val){
		Motor.C.setSpeed(val);
	}

		
	public static void outputA_STOP(){
		Motor.A.stop();
	}
	
	public static void outputB_STOP(){
		Motor.B.stop();
	}
	
	public static void outputC_STOP(){
	  Motor.C.stop();	
	}	
	
	
	public static void outputBEEP(){
		Sound.beep();
	}
	 
	
	
	
	//on peut rajouter pas les mothodes qu'on veut sur les moteurs
	
}